﻿namespace DimensionsHelper.Serialization.Enumerator;


/// <summary>
/// 指定某一个特定类型的注解和注解的属性名，并使用指定注解属性的值生成转换函数。
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class EnumAttributePropertySelectorAttribute : Attribute
{

    public EnumAttributePropertySelectorAttribute(Type enumType, Type attributeType)
    {
        EnumType = enumType;
        AttributeType = attributeType;
        ArgumentName = string.Empty;
        ConstructorArgIndex = -1;
        ConditionType = null;
        ConditionConstructorArgIndex = -1;
        ConditionArgumentName = null;
    }


    /// <summary>
    /// 指定的枚举类型。
    /// </summary>
    public Type EnumType { get; }


    /// <summary>
    /// 有效的注解类型。
    /// </summary>
    public Type AttributeType { get; }


    /// <summary>
    /// 绑定的属性名
    /// </summary>
    public string ArgumentName { get; set; }


    /// <summary>
    /// 构造函数的参数索引，忽略此属性时，
    /// </summary>
    public int ConstructorArgIndex { get; set; }


    /// <summary>
    /// 需要检查的条件值类型
    /// </summary>
    public Type? ConditionType { get; set; }


    /// <summary>
    /// 检查条件值的构造函数参数索引
    /// </summary>
    public int ConditionConstructorArgIndex { get; set; }


    /// <summary>
    /// 检查条件值的命名参数名称
    /// </summary>
    public string? ConditionArgumentName { get; set; }

}
